// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   dealwith_ok.java

package qcs.manufacture_procedure;

import include.nseer_cookie.counter;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class dealwith_ok extends HttpServlet
{

	public dealwith_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			HttpSession session = request.getSession();
			ServletContext context = session.getServletContext();
			String path = context.getRealPath("/");
			counter count = new counter(dbApplication);
			nseer_db_backup1 qcs_db = new nseer_db_backup1(dbApplication);
			if (qcs_db.conn((String)dbSession.getAttribute("unit_db_name")))
				try
				{
					String procedure_name = request.getParameter("procedure_name");
					String manufacture_id = request.getParameter("manufacture_id");
					String dealwith_tag1 = request.getParameter("dealwith_tag");
					String apply_id = request.getParameter("apply_id");
					String sql = "";
					if (dealwith_tag1.equals("2"))
					{
						sql = (new StringBuilder("update manufacture_procedure set qcs_tag='1' where manufacture_id='")).append(manufacture_id).append("' and procedure_name='").append(procedure_name).append("'").toString();
						qcs_db.executeUpdate(sql);
						sql = (new StringBuilder("update qcs_manufacture_procedure set dealwith_tag='1' where manufacture_id='")).append(manufacture_id).append("' and procedure_name='").append(procedure_name).append("'").toString();
						qcs_db.executeUpdate(sql);
					} else
					{
						sql = (new StringBuilder("update qcs_manufacture_procedure set check_tag='9' where manufacture_id='")).append(manufacture_id).append("' and procedure_name='").append(procedure_name).append("'").toString();
						qcs_db.executeUpdate(sql);
						sql = (new StringBuilder("update qcs_apply_details set qcs_tag='0' where apply_id='")).append(apply_id).append("'").toString();
						qcs_db.executeUpdate(sql);
					}
					qcs_db.commit();
					qcs_db.close();
					response.sendRedirect("qcs/manufacture_procedure/dealwith_ok.jsp");
				}
				catch (Exception ex)
				{
					ex.printStackTrace();
				}
			else
				response.sendRedirect("error_conn.htm");
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
